#!/usr/bin/env python
# -*- coding: UTF-8 -*-
def help():
	print 'Usage:'
	print 'dvd2mkv.py [-t numTitle | -h ] org'

class TConsole:
	def __init__(self, argv):
		import getopt, sys
		self.__argv = argv
		self.__org = ''
		self.__title = 0
		try:
			opts, args = getopt.getopt(self.__argv[1:], "ht:a:s:", ['help','title=','audios=','subtitles='])
		except getopt.error, msg:
			print msg
			print "For help use type --help"
			sys.exit(2)
		if args:
			self.__org = '"'+args[0]+'"'

		for o, a in opts:
			if o in ("-h", "--help"):
				help()
				sys.exit(0)
			elif o in ("-t", "--title"):
				self.__title = a
			elif o in ("-a", "--audios"):
				self.__audios = a
				print a
			elif o in ("-s", "--subtitles"):
				self.__subs = a
				print a

	def getOrg (self):
		return self.__org 
	def getTitle(self):
		return self.__title


	def esGrafica(self):
		if len(argv) > 1:
			return False
		else: 
			return True
	

from sys import argv
from ui import TUi
if __name__ == "__main__":
	console = TConsole(argv) 
	if len(argv) == 1 or console.getOrg():
		ui = TUi(console)
		ui.start()
	else:
		help()
	
		

